<template>
  <div>
    <van-nav-bar left-arrow @click-left="$router.push('/myClients')">
      <template #right>
        <img
          src="../../assets/images/首页按钮.png"
          alt=""
          width="50%"
          @click="$router.push('/home')"
        />
      </template>
    </van-nav-bar>

    <div class="imfor-header">
      <div class="card">
        <img src="../../assets/images/头像.png" alt="" />

        <div>
          <h2>名称：{{ imformationArr.custName }}</h2>
          <p>电话：{{ imformationArr.telephone }}</p>
        </div>

        <button class="btn" @click="gocustmer">客户信息</button>
      </div>
    </div>

    <van-tabs v-model="active">
      <van-tab>
          <template #title>
          <img src="../../assets/images/收入分析.png" alt="" class="imgs" />
          <span class="tit">收入分析 </span> </template><Shouru :ShouruArr="ShouruArr"/></van-tab>
      <van-tab>
          <template #title>
          <img src="../../assets/images/旗下企业.png" alt="" class="imgs" />
          <span class="tit">旗下企业 </span> </template><Business :BusinessArr="BusinessArr"/></van-tab>
      <van-tab>
          <template #title>
          <img src="../../assets/images/合作伙伴.png" alt="" class="imgs" />
          <span class="tit">合作伙伴 </span> </template><Partner :PartnerArr="PartnerArr"/></van-tab>
      <van-tab>
          <template #title>
          <img src="../../assets/images/当年收入.png" alt="" class="imgs" />
          <span class="tit">当年收入 </span> </template><Yearincome :YearincomeArr="YearincomeArr"/></van-tab>
    </van-tabs>
  </div>
</template>

<script>
import { Custview } from "../../request/api";
import Shouru from '../Cust/Shouru';
import Yearincome from '../Cust/Yearincome';
import Business from '../Cust/Business';
import Partner from '../Cust/Partner'
export default {
  data() {
    return {
      imformationArr: [],
      active: 2,
      ShouruArr:[],
      YearincomeArr:[],
      BusinessArr:[],
      PartnerArr:[]
    };
  },
  created() {
    Custview({ id: this.$route.query.id }).then((res) => {
      this.imformationArr = res.data;
    //   console.log(res);
      this.ShouruArr=res.data.datas[0]
      this.YearincomeArr= res.data.datas[1]
      this.BusinessArr= res.data.datas[3]
      this.PartnerArr = res.data.datas[2]
    });
  },
    components:{
        Shouru,
        Yearincome,
        Business,
        Partner
    },
  methods: {
    gocustmer() {
      // console.log(this.imformationArr.id);
      this.$router.push({
        path: "/custmerDetail",
        query: {
          id: this.imformationArr.id,
        },
      });
    },
  },
};
</script>
 
<style lang = "less" scoped>
/deep/.van-nav-bar {
  background-color: #003399;

  .van-icon-arrow-left::before {
    color: #fff;
  }
  .van-nav-bar__text {
    color: #fff;
  }
  .van-nav-bar__right {
    padding: 0;
  }
}

/deep/[class*="van-hairline"]::after {
  border: 0;
}
.imfor-header {
  height: 130px;
  width: 100%;
  background-color: #003399;
  overflow: hidden;
  padding: 0 30px;
  box-sizing: border-box;
  .card {
    width: 100%;
    margin-top: 20px;
    background-color: #fff;
    border-radius: 8px 8px 0 0;
    height: 100%;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    img {
      width: 20%;
      margin-left: 20px;
    }
    div {
      margin-left: 20px;
    }
    p {
      margin-top: 5px;
      color: #666;
      font-size: 14px;
    }

    .btn {
      width: 70px;
      border: 0;
      font-size: 12px;
      padding: 5px 0;
      border-radius: 20px;
      background-color: #fad157;
      color: #fff;
      position: absolute;
      right: -10px;
      top: 20px;
    }
  }
}

.imgs {
  width: 30%;
  display: block;
  margin-left: 15px;
}

.tit {
  font-size: 12px;
  color: #003399;
}

/deep/.van-tabs__line {
  background-color: #fad157;
  width: 55px;
}
</style>